package com.miyake.client.trash;

import java.util.List;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.miyake.client.profile.AbstractUserList;
import com.miyake.client.tools.ImageListElement;

public abstract class FriendList extends AbstractUserList{
	abstract protected String getKey();
	
	@Override
	protected String getListTitle() {
		return "Friend List";
	}

	@Override
	protected int getColumnCount() {
		return 8;
	}
	
	@Override
	protected boolean canAdd() {
		return false;
	}
	
	@Override
	protected void getList() {
		service.getFriendList(getKey(), new AsyncCallback<List<ImageListElement>>() {
			@Override
			public void onFailure(Throwable caught) {
				Window.alert(caught.getMessage());
			}

			@Override
			public void onSuccess(List<ImageListElement> result) {
				showList(result, getColumnCount());
			}
		});
	}
}
